<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %> 
<%
java.lang.String urlpath = request.getContextPath();
%>
<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_AUDIT">
<%
response.setHeader("refresh","600");
 %>
</sec:authorize>

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>百万微博平台</title>
<meta http-equiv="expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<link rel="stylesheet" href="../css/admin_style.css" />
<script type="text/javascript" src="../js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="../js/core/core.js"></script>
<script type="text/javascript">
//check used
function showselect(type){
	var selects = get_tags(document,'select');
	for (i=0; i<selects.length; i++) {
		selects[i].style.visibility = type;
	}
}
function checkgroupset(chars){
	if (!confirm("确定删除吗? 如果您删除了此代理组,请到站点缓存数据管理更新代理头衔缓冲!")) return false;
	window.location.href = chars;return false;
}
function get_tags(parentobj,tag){
	if (typeof parentobj.getElementsByTagName!='undefined') {
		return parentobj.getElementsByTagName(tag);
	} else if (parentobj.all && parentobj.all.tags) {
		return parentobj.all.tags(tag);
	} else {
		return null;
	}
}
//other function
function atccheck(){
	if(document.FORM.atc_title.value==''){
		alert('标题为空');
		document.FORM.atc_title.focus();
		return false;
	} else if(document.FORM.fid.value==''){
		alert('没有选择文章所属分类');
		document.FORM.fid.focus();
		return false;
	}
	_submit();
}
function level_jump(admin_file){
	var URL=document.mod.selectfid.options[document.mod.selectfid.selectedIndex].value;
	location.href=admin_file+"?adminjob=level&action=editgroup&gid="+URL;
}
function ip_jump(name){
	URL = eval('document.form1.' + name + '.options[document.form1.' + name + '.selectedIndex].value');
	location.href=URL;
}
function pwJsCheck(_this,check,tagName){
	try{
		if (typeof tagName == 'undefined') tagName = "tr";
		if (typeof check == 'undefined') {
			if (typeof _this.checked == 'boolean') {
				check = _this.checked;
			} else {
				check = false;
			}
		}
		var o = _this.parentNode;
		var i = 3;
		while(i--){
			if (o.nodeName.toLowerCase() == tagName) {
				var className =  o.className.replace(/\s?td_bgC/ig, "");
				if (check) {
					className +=' td_bgC';
				}
				o.className = className;
				break;
			} else {
				o = o.parentNode;
			}
		}
	}catch(e){}
}
//Cookies Function
function getCookie(name) {
    var start = document.cookie.indexOf(name + '=');
    var len = start + name.length + 1;
    if ((!start) && (name != document.cookie.substring(0, name.length))) {
        return null;
    }
    if (start==-1) {
        return null;
    }
    var end = document.cookie.indexOf(';', len);
    if (end == -1) {
        end = document.cookie.length;
    }
    return unescape(document.cookie.substring(len,end));
}
function setCookie(name, value, expires, path, domain, secure) {
	if (!expires) {
		expires = new Date();
		expires.setTime(expires.getTime()+31536000);
	}
	document.cookie = name + '=' + escape(value) +
        ( (expires) ? ';expires=' + expires.toGMTString() : '') +
        'path=' + ( (path) ? path : '/') +
        ( (domain)  ? ';domain=' + domain : '') +
        ( (secure)  ? ';secure' : '');
}

function elementBind(type,id,stylename,csstext){
	var element = document.createElement(type);
	if (id) {
		element.id = id;
	}
	if (typeof(stylename) == 'string') {
		element.className = stylename;
	}
	if (typeof(csstext) == 'string') {
		element.style.cssText = csstext;
	}
	return element;
}
function addChild(parent,type,id,stylename,csstext){
	parent = objCheck(parent);
	var child = elementBind(type,id,stylename,csstext);
	parent.appendChild(child);
	return child;
}

function delElement(id){
	id = objCheck(id);
	id.parentNode.removeChild(id);
}
function objCheck(obj) {
	if (typeof(obj)=='string') {
		obj	= getObj(obj);
	}
	return obj;
}

function shenhe(id){
	$.ajax({
		type:"GET",
		url:"<%=urlpath%>/ajax/auditWeiboIndentFor163",
		dataType:"json",
		data:{indentId:id,base:1},
		success:function(result)
		{
			if(result&&result==1){
				alert("审核成功!");
				location.reload();
			}else{
				alert("审核成功失败!");
			}
		}
	});

}

document.onkeydown = function(e){
	var e = is_ie ? window.event: e;
	if ( e.keyCode==116) {
		window.location.reload();
		if (is_ie) {
			e.keyCode = 0;
       		e.cancelBubble = true;
		}
		return false;
	}
}

function openNewUrl(id,name,url){
	parent.PW.Dialog({
		'id': id,
		'name': name,
		'url': url
	}).loadIframe(url);
}
</script>

<script type="text/javascript">
var manageclass = {
	superdel : function (obj,forumid,step){
		var form = getObj(forumid);
		form.step.value = step;
		var page = obj.getAttribute("page");
		if(!page){
			page = getObj("input_page").value;
		}
		page = (page) ? page : 1;
		form.page.value = page;
		setTimeout(function(){
			form.submit();
		},0);
	}
}
onReady(function(){
	if(parent.adminNavClass){
		parent.adminNavClass.initTips();
	}
})
</script>
</head>
<body>
<div class="wrap">

<div id="notice"></div>

<style type="text/css">
.admin_table .td1,.admin_table .td2{padding:4px 5px 4px 15px;line-height:22px;}
</style>
<div class="admin_info mb10">
	<h4 class="h1">平台提示</h4>
	<sec:authorize ifNotGranted="ROLE_AUDIT">
	<div class="legend">
		${indexPointOut.pointOut}
	</div>
	</sec:authorize>
</div>

<div class="cc">
	<div>
	<h4 class="h1">您的资料</h4>
    <div class="admin_table mb10">
        <table width="100%">
            <tr class="tr1 vt">
                <td class="td1">当前帐号</td>
                <td class="td2">${curUser.userAccount }</td>
            </tr>
            <tr class="tr1 vt">
                <td class="td1">代理级别</td>
               <sec:authorize ifAnyGranted="ROLE_ROOT">
               	<td class="td2">超管</td>
               </sec:authorize>
               <sec:authorize ifAnyGranted="ROLE_ADMIN">
               	<td class="td2">管理人员</td>
               </sec:authorize>
               <sec:authorize ifAnyGranted="ROLE_USER">
               	<td class="td2">返利代理</td>
               </sec:authorize>
               <sec:authorize ifAnyGranted="ROLE_USER_2">
               	<td class="td2">代理</td>
               </sec:authorize>
               <sec:authorize ifAnyGranted="ROLE_AUDIT">
               	<td class="td2">合作人员</td>
               </sec:authorize>
                
            </tr>
             <sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN,ROLE_USER,ROLE_USER_2">
	  	    <tr class="tr1 vt">
			    <td class="td1">余额信息</td>
			    <td class="td2">
                    您帐户余额：<span style="font-size:18px;font-weight:bold;color:red;" id="fans_c">${curUser.money }</span> 元；
         <sec:authorize ifNotGranted="ROLE_USER_2">             
                       下级余额（总）：<span style="font-size:18px;font-weight:bold;color:blue;" id="fans_b">${theMoneyOfChildens }</span> 元；
                      完成返利：<span style="font-size: 18px; font-weight: bold; color: green;" id="fans_a">${rebate }</span> 元；
                       预计返利：<span style="font-size: 18px; font-weight: bold; color: green;" id="fans_a">${runningRebate }</span> 元；
                 </sec:authorize> </td>
              </tr>
              <sec:authorize ifNotGranted="ROLE_USER_2">
	  	    <tr class="tr1 vt">
			    <td class="td1">昨日返现</td>
			    <td class="td2"><span style="font-size: 18px; font-weight: bold; color: green;" id="fans_rebate">${rebateYesterday }</span> 元</td>
	  	    </tr>
	  	    </sec:authorize>
	  	    </sec:authorize>
            <tr class="tr1 vt">
                <td class="td1">上次登录时间</td>
                <td class="td2">${curUser.lastLoginTime }</td>
            </tr>
            <tr class="tr1 vt">
                <td class="td1">上次登录IP</td>
                <td class="td2">${curUser.lastLoginIp }</td>
            </tr>
        </table>
    </div>
    </div>
<sec:authorize ifAnyGranted="ROLE_ADMIN,ROLE_AUDIT">
	<div>
	<h4 class="h1">订单提醒</h4>
    <div class="admin_table mb10">
        <table width="100%">
        <c:forEach items="${stateNumberList}" var="stateNumber" varStatus="s" step="1">
        	 <tr class="tr1 vt">
                <td class="td1">${stateNumber.baseIndentType.baseIndentTypeClassify.name}--${stateNumber.baseIndentType.name }</td>
                <c:if test="${stateNumber.baseIndentType.stateType=='default' }">
                	<td class="td2">
                		排队中：<span style="color:red;font-weight:bold;font-size:14px;">${stateNumber.paidui }</span>&nbsp;&nbsp;
                		执行中：<span style="color:blue;font-weight:bold;font-size:14px;">${stateNumber.zhixing }</span>&nbsp;&nbsp;
                		已完成：<span style="color:green;font-weight:bold;font-size:14px;">${stateNumber.wancheng }</span>&nbsp;&nbsp;
                	</td>
                </c:if>
                <c:if test="${stateNumber.baseIndentType.stateType=='renzheng' }">
                	<td class="td2">
                		排队中：<span style="color:red;font-weight:bold;font-size:14px;">${stateNumber.rz_paidui }</span>&nbsp;&nbsp;
                		审核中：<span style="color:blue;font-weight:bold;font-size:14px;">${stateNumber.rz_shenhe }</span>&nbsp;&nbsp;
                		已认证：<span style="color:green;font-weight:bold;font-size:14px;">${stateNumber.rz_renzheng }</span>&nbsp;&nbsp;
                		已完成：<span style="color:green;font-weight:bold;font-size:14px;">${stateNumber.rz_wancheng }</span>&nbsp;&nbsp;
                	</td>
                </c:if>
                
            </tr>
        </c:forEach>
           
        </table>
    </div>
    </div>
    <script>
    	var paidui_num = ${hasIndentNoAudit};
    	if(paidui_num==1){
    		$('<audio id="chatAudio"><source src="../vod/message.mp3" type="audio/mp3"></audio>').appendTo('body');//载入声音文件 
    		$('#chatAudio')[0].play(); //播放声音 

    	}
    </script>
</sec:authorize>
<sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_USER,ROLE_USER_2">
    
<h2 class="h1"><span class="fl mr10"><b>充值消费记录</b></span><a hidefocus="true" onclick="openNewUrl('financerecorddetail','查看详细记录','financial/toConsumptionRecords');" class="btn_add fl" style="margin-left:10px;"><i>充值消费详情</i></a></h2>
<div class="admin_table mb10">

<table width="100%" cellspacing="0" cellpadding="0">
	<tbody>
      <tr class="tr2 td_bgB">
		<td>ID</td>
		<td>财务主体</td>
		<td>收支类型</td>
        <td>发生金额</td>
        <td>订单(若有)</td>
        <td>描述</td>
		<td>操作人</td>
		<td>帐户余额</td>
		<td>发生时间</td>
	</tr>
	<c:forEach items="${paginationSupport.items }" var="item" step="1" varStatus="u">
		<tr class="tr1 vt">
		<td class="td2">${u.index+1 }</td>
        <td class="td2"><p class="lh_18" title="">${curUser.userAccount }</p></td>
        <td class="td2">
        	<c:if test="${item.type==0 }">
        	<span style="color:red">支出</span>
        	</c:if>
        	<c:if test="${item.type==1 }">
        	<span style="color:green">收入</span>
        	</c:if>
            
        </td>
        <td class="td2">${item.money }</td>
        <td class="td2"><p class="lh_18" title="">
        	<c:if test="${item.userIndent!=null }">
        		${item.userIndent.id}
        	</c:if>
        </p></td>
        <c:if test="${item.userIndent!=null }">
        	<c:if test="${item.type==0&&item.type2!=4 }">
        		<td class="td2"><p class="lh_18" title="">用户【${item.indentCreateUser.userAccount }】生成订单【${item.userIndent.id}】，花费【${item.money }】</p></td>
        	</c:if>
        	<c:if test="${item.type==1&&item.type2!=4 }">
        		<td class="td2"><p class="lh_18" title="">用户【${item.indentCreateUser.userAccount }】完成订单【${item.userIndent.id}】，返利【${item.money }】</p></td>
        	</c:if>
        	<c:if test="${item.type==1&&item.type2==4 }">
        		<td class="td2"><p class="lh_18" title="">订单【${item.userIndent.id}】退款，返还【${item.money }】</p></td>
        	</c:if>
        	
        </c:if>
        <c:if test="${item.userIndent==null }">
        	<c:if test="${item.type==0 }">
        		<td class="td2"><p class="lh_18" title="">为用户【${item.user.userAccount }】充值划款，花费【${item.money }】</p></td>
        	</c:if>
        	<c:if test="${item.type==1 }">
        		<td class="td2"><p class="lh_18" title="">帐户充值</p></td>
        	</c:if>
        </c:if>
        <c:if test="${item.user==null }">
        	<td class="td2"><p class="lh_18" title="">admin</p></td>
        </c:if>
        <c:if test="${item.user!=null }">
        	<c:if test="${item.type==0 }">
        	<td class="td2"><p class="lh_18" title="">${curUser.userAccount }</p></td>
        	</c:if>
        	<c:if test="${item.type==1 }">
        	<td class="td2"><p class="lh_18" title="">${item.user.userName }</p></td>
        	</c:if>
        </c:if>
        <td class="td2">${item.userAllMoney }</td>
		<td class="td2">${item.createDate }</td>
	</tr>
	</c:forEach>
	
	
</tbody></table>
</div>

</sec:authorize>
<!-- 
<sec:authorize ifAnyGranted="ROLE_AUDIT">
<h2 class="h1"><span class="fl mr10"><b>订单记录</b></span></h2>
<div class="admin_table mb10">
<table width="100%" cellspacing="0" cellpadding="0" style="margin-top:-8px;">
	<tbody>
      <tr class="tr2 td_bgB">
		<td>序号</td>
        <td>订单编号</td>
		<td>目标</td>
		<td>进度</td>
		<td>初始数量</td>
		<td>订单状态</td>
		<td>执行时间</td>
        <td>操作</td>
	</tr>
	<c:forEach var='indent' items='${paginationSupportForAudit.items}' varStatus='u'  step='1'>
		<tr class="tr1 vt">
          <td class="td2">${u.index+1}</td>
          <td class="td2"><b>${indent.id }</b></td>
		  <td class="td2"  style="height:18px;"><a href="${indent.targetUrl }" target="_blank">${indent.targetTitle }</a></td>
		  <td class="td2" style="font-weight:bold;"><font color="green">${indent.nowNumber-indent.startNumber }</font>/<font color="blue">${indent.number }</font></td>
          <td class="td2">
              ${indent.startNumber }
          </td>
          <td class="td2">
          <c:if test="${indent.state==0 }">
          	<span style="color:red;">未审核</span>
          </c:if>
          <c:if test="${indent.state==1 }">
          	<span style="color:blue;">执行中……</span>
          </c:if>
          <c:if test="${indent.state==2 }">
          	<span style="color:green;">已完成√</span>
          </c:if>
          <c:if test="${indent.state==3 }">
          	<span style="color:red;">已退款×</span>
          </c:if>
          </td>
          <td class="td2">下单时间：<font color="green">${indent.createDate }</font><br>结束时间：<font color="blue">${indent.endDate }</font></td>
          <sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN,ROLE_USER">
          	<td class="td2">${indent.totalPrice }元</td>
          </sec:authorize>
          <td class="td2">
             <sec:authorize ifAnyGranted="ROLE_ROOT,ROLE_ADMIN,ROLE_AUDIT">
             	<c:if test="${indent.state==0 }">
          			<a href="#" onclick="shenhe(${indent.id });">审核</a><br/>
          			<a href="<%=urlpath %>/indent/toIndentRefund?userIndent.id=${indent.id }" target="_self">退款</a><br/>
          		</c:if>
          		<c:if test="${indent.state==1 }">
          			<a href="<%=urlpath %>/indent/toIndentRefund?userIndent.id=${indent.id }" target="_self">退款</a><br/>
          		</c:if>
             </sec:authorize>
             <a href="<%=urlpath %>/indent/toIndentDetails?userIndent.id=${indent.id }" target="_self">详情</a><br/>
           </td>
    </tr>
	</c:forEach>
	
    

</tbody></table>
</div>
</sec:authorize>
 -->
</div>

<!--<h2 class="h1">最新管理操作记录</h2>
<div class="admin_table mb10">
    <table width="100%">
    <tr class="tr2">
        <td width="10%">代理名</td>
        <td width="10%">IP</td>
        <td width="15%">操作时间</td>
        <td width="30%">操作理由</td>
    </tr>

<tr class="tr1">
<td class="td2"><a href='/admin.php?adminjob=usermanage&adminitem=edit&action=search&schname=admin&schname_s=1' onclick="openNewUrl('usermanage','代理管理',this.href);return false;">admin</a></td>
<td class="td2">127.0.0.1</td>
<td class="td2">2012-07-12 11:34</td>
<td class="td2">11
</td>
</tr>
    </table>
</div>    -->

<script type="text/javascript">
function WhereToJump(id,name,v,url){
	if (document.getElementById(v).value) {
		openNewUrl(id,name,'/admin.php?' + url + document.getElementById(v).value);
	}
	return false;
}
</script>
<div id="system" style="display:none;"></div>

<div class="c"></div>
</div>

<div class="bottom" style="text-align:center;">

</div>

<script type="text/javascript" src="../js/global.js"></script>
<script type="text/javascript" src="../js/pw_ajax.js"></script>
<script type="text/javascript" src="../js/admin.js"></script>
<script type="text/javascript" src="../js/desktop/plugin.js"></script>
<script type="text/javascript">
var allInputs = document.getElementsByTagName('input');
if(allInputs && allInputs.length>0){
	for(var i=0; i<allInputs.length;i++)
	{
		var ipt = allInputs[i].parentNode;
		if(ipt.tagName=='LI'&& allInputs[i].type=='radio')
		{
			allInputs[i].checked && (ipt.className='current');
			ipt.onclick = function(){radioWithWords(this)};
		}
	}
}
</script>
</body></html>
